<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>学生列表</title>
<script language="JavaScript" src="/WF/Comm/JScript.js" type="text/javascript" ></script>
    <script type="text/javascript" src="../../../WF/Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../../WF/Scripts/bootstrap/js/bootstrap.min.js"></script>
    <script src="../../../WF/Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../WF/Scripts/config.js" type="text/javascript"></script>
    <base target="_self" /> 
    <link href="../../../WF/Comm/Style/Table0.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
        /* ESC Key Down */
        function Esc() {
            if (event.keyCode == 27)
                window.close();
            return true;
        }

        //页面启动函数.
        $(function () {
            $("#Msg").html("正在加载,请稍后......");

            InitPage();

            $("#Msg").html("");
        });

        //初始化数据.
        function InitPage() {

          //  var fk_mapData = GetQueryString("FK_MapData");

            //初始化表格.
            $.ajax({
                type: 'post',
                async: true,
                url: basePath+"/SDKFlowDemo/BPFramework/DataInputJQ/Student.do?DoType=StudentList_Init&m=" + Math.random(),
                dataType: 'html',
                success: function (data){

                    data = JSON.parse(data);

                    //增加处理.
                    for (var i = 0; i < data.length; i++) {

                        var newRow = "";

                        newRow = "<tr ><td class=Idx>" + i + "</td>";
                        newRow += "<td>" + data[i].no + "</td>";
                        newRow += "<td>" + data[i].name + "</td>";
                        newRow += "<td>" + data[i].tel + "</td>";
                        newRow += "<td>" + data[i].email + "</td>";
                        newRow += "<td>" + data[i].addr + "</td>";
                        
                        newRow += "<td>";
                        newRow += "<a href=\"javascript:Edit('" + data[i].no + "')\"><img src='../../../WF/Img/Btn/Edit.gif' border=0 />编辑</a>";
                        newRow += "<a href=\"javascript:Delete('" + data[i].no + "')\"><img src='../../../WF/Img/Btn/Delete.gif' border=0 />删除</a>";
                        newRow += "</td>";
                        
                        newRow += "</tr>";

                        $("#Table1 tr:last").after(newRow);
                    }
                }
            });
        }

        function Delete(no) {

            if (window.confirm('您确定要删除吗？') == false)
                return;

            //删除学生.
            $.ajax({
                type: 'post',
                async: true,
                url: basePath+"/SDKFlowDemo/BPFramework/DataInputJQ/Student.do?DoType=StudentList_Delete&No=" + no + "&m=" + Math.random(),
                dataType: 'html',
                success: function (data) {

                    $("#Msg").html(data);


                    if (data.indexOf('err@') == 0) {
                        alert(data);
                        return;

                    } else {
                        
                        alert(data);

                        window.location.href = window.location.href;
                    }
                }
            });
        }

        function Edit(no) {
            var url = 'student.htm?No=' + no;
            var b = window.showModalDialog(url, 'ass', 'dialogHeight: 400px; dialogWidth: 500px;center: yes; help: no');
            window.location.href = window.location.href;
        }
        
        function WinOpen() {
            var url = 'student.htm';
            var b = window.showModalDialog(url, 'ass', 'dialogHeight: 800px; dialogWidth: 700px;center: yes; help: no');
            window.location.href = window.location.href;
        }
     </script>
</head>
<body onkeypress="Esc()" >


<table id="Table1">
<caption>学生列表  - <a href="javascript:WinOpen()">新增</a></caption>
<tr>
<th>序</th>
<th>学号</th>
<th>名称</th>
<th>电话</th>
<th>邮件</th>
<th>地址</th>
<th>操作</th>
</tr>
</table>
<div id="Msg"></div>

</body>
</html>